"""登录页面"""
from selenium.webdriver.common.by import By

from dianzishangwu_testing.page_objects.base_page import BasePage


class LoginPage(BasePage):
    _BASE_URL = "http://litemall.hogwarts.ceshiren.com/#/login"

    __INPUT_USERNAME = (By.NAME, "username")
    __INPUT_PASSWORD = (By.NAME, "password")
    __BTN_LOGIN = (By.XPATH, "//*[@type='button']")

    def login(self):
        self.do_send_keys('admin123', self.__INPUT_USERNAME)
        self.do_send_keys('admin123', self.__INPUT_PASSWORD)
        self.do_find(self.__BTN_LOGIN).click()

        from dianzishangwu_testing.page_objects.home_page import HomePage
        return HomePage(self.driver)
